import numpy as np
import matplotlib.pyplot as plt

# 数据
datasets = ["aes128", "aes256", "aes_cipher", "or1200", "sha3", "usb_cdc_core", "usbf_device"]
models = ["TimingGCN", "GAT Only", "GAT + Global Feature", "GAT + CNN", "Our Full"]
values = np.array([
    [0.8754, 0.8827, 0.8954, 0.9446, 0.9568],
    [0.8689, 0.8780, 0.8923, 0.9529, 0.9669],
    [0.8524, 0.8472, 0.8641, 0.9103, 0.9400],
    [0.9449, 0.9479, 0.9547, 0.9542, 0.9516],
    [0.9451, 0.9704, 0.9720, 0.9729, 0.9754],
    [0.8595, 0.8732, 0.9012, 0.9450, 0.9266],
    [0.9000, 0.9121, 0.9196, 0.9398, 0.9492],
])

markers = ['o', 's', 'D', '^', '*']

# 重新绘制折线图，调整颜色并保存图片

# 颜色方案
colors = ['b', 'g', 'r', 'c', 'm']  # 蓝色、绿色、红色、青色、洋红色

# 设置全局字体大小
plt.rcParams.update({'font.size': 18})

# 重新绘制折线图
plt.figure(figsize=(14, 6))
for i, model in enumerate(models):
    plt.plot(datasets, values[:, i], marker=markers[i], linestyle='-', color=colors[i], label=model)

plt.ylabel("R² Value")
plt.legend(loc='upper center', bbox_to_anchor=(0.5, 1.15), ncol=5, fontsize=14)
plt.grid(True)
plt.xticks(rotation=0)  # 让 x 轴标签水平



# 保存图片
output_path = "/home/hujiahui/git/paper/tool/net_delay_xiaorong_plot.png"
plt.savefig(output_path, dpi=300)
plt.show()

